package arthas;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public class Demo {

	static class Counter {

		private Counter() {
		}

		private static AtomicInteger count = new AtomicInteger(0);

		public static void incre() {
			count.incrementAndGet();
		}

		public static int value() {
			return count.get();
		}

	}

	public static void main(String[] args) throws InterruptedException {

		while (true) {
			Counter.incre();   
			System.out.println(Counter.value());
			TimeUnit.SECONDS.sleep(1L);
		}
	}

}
